#include <iostream>
#include <conio.h>
#include <ctime>

void countbals(int , int);

int main(){
	int result = 2 ;
	int mul1 = 0 ; 
	int mul2 = 0 ;
	int countquestions = 0;
	int counttrueanswer = 0;
	int trueresult = 0;
	while( result != -1 ){
		countquestions = 0;
		counttrueanswer = 0;
		std:: cout << "where multiplayng table you want write that number or if you want all multiplayinq table press 0" << std::endl ;
		std:: cin >> result ;
		if(0 == result){
			std:: cout << "if you want exit your exam about all multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = rand() % 9 + 1;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(1 == result){
			std:: cout << "if you want exit your exam about 1 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 1;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(2 == result){
			std:: cout << "if you want exit your exam about 2 multiplay tabel  and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 2;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(3 == result){
			std:: cout << "if you want exit your exam about 3 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				mul1 = 3;
				std::srand(std::time(0));
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(4 == result){
			std:: cout << "if you want exit your exam about 4 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 4;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(5 == result){
			std:: cout << "if you want exit your exam about 5 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 5;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(6 == result){
			std:: cout << "if you want exit your exam about 6 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 6;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(7 == result){
			std:: cout << "if you want exit your exam about 7 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 7;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(8 == result){
			std:: cout << "if you want exit your exam about 8 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 8;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if(9 == result){
			std:: cout << "if you want exit your exam about 9 multiplay tabel and take your bals please enter any number press -2" << std::endl ;
			while( result != -2 ){
				std::srand(std::time(0));
				mul1 = 9;
				mul2 = rand() % 9 + 1;
				std:: cout << mul1 << " * " << mul2 << "= ";
				std:: cin >> result;
				std:: cout << std::endl;
				if(result >= 1){
				trueresult = mul1 * mul2; 
				std:: cout << "true answer = " << trueresult << std::endl;
				countquestions++;
				if(result == trueresult){
					counttrueanswer++;
				}
			}
			}
			countbals(countquestions, counttrueanswer);
		}
		else if( result != -1 ){
			std::cout << "your chose false if you want to your chose is true see down or press -1 to exit" << std::endl;
		}
	}	
	getch();
	return 0;
} 
void countbals(int cq , int cta){
	double bals = 0.0;
	std:: cout << "count of ask = " << cq << std::endl ; 
	std:: cout << "count of true answer = " << cta << std::endl ;
	bals = ( (double)10 / (double)cq) * cta ;
	std:: cout << "your bals = " << bals << std:: endl;
}